import './index.less';
import { getAntd,getEcCom,getLabel } from '../../../util/convert';
import {observer} from "mobx-react/index";
import fieldTriggerConfirmStore from '../../../stores';

/**
 * 明细导入触发字段联动确认框
 */
@observer
export default class FieldTriggerConfirm extends React.Component {
    constructor(props) {
        super(props);
        const options = [
            {
                key: "1",
                selected: true,
                showname: getLabel(390210,'执行')
            },{
                key: "0",
                selected: false,
                showname: getLabel(390211,'不执行')
            }
        ];
        this.state ={
            options : options,
            isFieldTrigger : "0",
        };
    }

    render() {
        const {Button} = getAntd();
        const { WeaDialog,WeaSelect,WeaFormItem} = getEcCom();
        const {options,isFieldTrigger} = this.state;
        const {onChange,} = this.props;
        return (
            <div>
                <WeaFormItem wrapperCol={{span: 24}}>
                    <p style={{'font-size':'14px'}}>{getLabel(390212 ,'导入时是否执行明细表字段联动？')}</p>
                    <p style={{'font-size':'14px'}}>{getLabel(390213,'（明细导入执行字段联动时将直接修改数据库值）')}</p>
                </WeaFormItem>
                <WeaFormItem wrapperCol={{span: 24}}>
                    <WeaSelect
                        options={options}
                        value={isFieldTrigger}
                        canSelectRepeat = {true}
                        detailtype={3}
                        onChange={(v,showname)=>{
                            if(v===""){
                                v = isFieldTrigger;
                            }
                            this.setState({isFieldTrigger : v});
                            onChange(v);
                        }} />
                </WeaFormItem>
        </div>
        );
    }
}
